---
layout: example
categories: example/v1.0.0
version: v1.0.0
title: Marker movement
description: Simple marker animation.
tags:
  - animation
  - markers
---
<div id='map'></div>

<script>
var map = L.mapbox.map('map', 'mapbox.light')
  .setView([29, -26], 2);

var marker = L.marker([-73, 40], {
    icon: L.mapbox.marker.icon({
      'marker-color': '#f86767'
    })
});

var t = 0;
window.setInterval(function() {
    // Making a lissajous curve just for fun.
    // Create your own animated path here.
    marker.setLatLng(L.latLng(
        Math.cos(t * 0.5) * 50,
        Math.sin(t) * 50));
    t += 0.1;
}, 50);

marker.addTo(map);
</script>
